package com.ys.erp.entity.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ys.erp.entity.data.bean.Information;
import com.ys.erp.entity.mapper.InformationMapper;
import com.ys.erp.entity.service.IInformationService;
import org.springframework.stereotype.Service;

/**
 * @author lwj
 * @date 2025/5/28
 */
    
@Service
public class IInformationServiceImpl extends ServiceImpl<InformationMapper, Information> implements IInformationService {

    @Override
    public Information getPulseInformation() {
        QueryWrapper<Information> informationQw = new QueryWrapper<>();
        informationQw.lambda().eq(Information::getInformationType, Information.Enums.PULSE.name());
        informationQw.lambda().last("limit 1");
        informationQw.lambda().orderByDesc(Information::getCreateTime);
        return this.getOne(informationQw);
    }

    @Override
    public Information getMallInformation() {
        QueryWrapper<Information> informationQw = new QueryWrapper<>();
        informationQw.lambda().eq(Information::getInformationType, Information.Enums.MALL.name());
        informationQw.lambda().last("limit 1");
        informationQw.lambda().orderByDesc(Information::getCreateTime);
        return this.getOne(informationQw);
    }

}
